package com.laxia.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 文件上传支持的文件类型
 */
public enum FileTypeEnum {


    /**
     * ("系统转换的统一类型", "contenType获取的类型"),
     */
    jpeg(1, "image/jpeg"),
    jpg(1, "image/jpg"),
    bmp(1, "image/bmp"),
    png(1, "image/png"),
    xwav(2, "audio/x-wav"),
    wav(2, "audio/wav"),
    mpeg(2, "audio/mpeg"),
    mp3(2, "audio/mp3"),
    mp4(3, "video/mp4"),
    xflv(3, "video/x-flv"),
    flv(3, "video/flv"),
    mov(3, "video/quicktime"),
    wmv(3, "video/x-ms-wmv"),

    ;

    private String code;
    private Integer value;

    FileTypeEnum(Integer value, String code) {
        this.value = value;
        this.code = code;
    }

    public Integer getValue() {
        return value;
    }

    public String getCode() {
        return code;
    }


    public static Map<String, Integer> getMap() {
        Map<String, Integer> map = new HashMap(values().length);
        for (FileTypeEnum client : values()) {
            map.put(client.getCode(), client.getValue());
        }
        return map;
    }

    public static Map<String, String> getTypeNameMap() {
        Map<String, String> map = new HashMap(values().length);
        for (FileTypeEnum client : values()) {
            map.put(client.getCode(), client.name());
        }
        return map;
    }

}
